<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class ModifyWorkOrderFeedback extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (!Schema::hasColumn('work_order_receipt', 'satisfaction')) {
            Schema::table('work_order_receipt', function (Blueprint $table) {
                $table->unsignedInteger('satisfaction')->after('signature')->default(0)->comment('客户满意度');
                $table->unsignedInteger('attitude')->after('satisfaction')->default(0)->comment('服务态度');
                $table->unsignedInteger('efficiency')->after('attitude')->default(0)->comment('服务效率');
            });
        }

        if (!Schema::hasColumn('work_order_receipt', 'description')) {
            Schema::table('work_order_receipt', function (Blueprint $table) {
                $table->text('description')->after('reason')->comment('详情');
            });
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
